// WirtschaftsSimGraphDat.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "stdlib.h"
#include "time.h"

void HardeFlorianSimulation()
{
	const int n = 80;
	bool valueArray[n][100];
	int rnd,cntr;


	srand(time(NULL));

	for (int i = 0; i < n; i++)
	{
		rnd = rand() % 2;
		if (rnd!=1)
		{
			valueArray[i][0]=false;
			printf("| ");
		}
		else
		{
			valueArray[i][0]=true;
			printf("|X");
		}
		
	}
	
	printf("\n");

	for (int rows = 1; rows < 100; rows++)
	{
		for(int colms = 0; colms < n; colms++)
		{
			cntr=0;
			for(int tstrn = -2; tstrn <= 2; tstrn++)
			{
				if( colms+tstrn < 0 || colms+tstrn > n-1 )
				{
				}
				else
				{
					if(valueArray[colms+tstrn][rows-1]==true)
						cntr++;
				}
			}
			//printf(" %i ",cntr);
			if((cntr % 2 == 0)&&(cntr != 0))
			{
				printf("|X");
				valueArray[colms][rows]=true;
			}
			else
			{
				printf("| ");
				valueArray[colms][rows]=false;
			}
		}
		printf("\n");
	}
	system("PAUSE");
	return(0);
}
